<!-- <template>
  <div>首頁</div>
</template>

<script>
export default {
  name: 'home'

}
</script>

<style></style> -->

<template>
  <div class="dashboard">
    <div class="container">
      <!-- 左侧内容 -->
      <div class="left">
        <div class="panel">
          <!-- 个人信息 -->
          <div class="user-info">
            <img class="avatar" src="../../assets/common/defaultHead.png" alt="">
            <div class="company-info">
              <div class="title">
                Made In China
                <span>体验版</span>
              </div>
              <div class="depart">南昌 ｜ 黑马-特训营</div>
            </div>
          </div>
          <!-- 代办 -->
          <div class="todo-list">
            <div class="todo-item">
              <span>组织总人数</span>
              <!-- 起始值 终点值  滚动时间 -->
              <CountTo :start-val="0" :end-val="16" :duration="1000"></CountTo>
            </div>

            <!-- <div class="todo-item">
              <span>合同待签署</span>
              <span>345</span>
            </div> -->
            <div class="todo-item">
              <span>商品数量</span>
              <CountTo :start-val="0" :end-val="8567" :duration="1000"></CountTo>
            </div>
            <div class="todo-item">
              <span>会员数量</span>
              <CountTo :start-val="0" :end-val="617" :duration="1000"></CountTo>

            </div>
            <div class="todo-item">
              <span>订单数量</span>
              <CountTo :start-val="0" :end-val="23497" :duration="1000"></CountTo>

            </div>
            <div class="todo-item">
              <span>店铺数量</span>
              <CountTo :start-val="0" :end-val="789" :duration="1000"></CountTo>

            </div>
          </div>
        </div>
        <!-- 快捷入口 -->
        <div class="panel">
          <div class="panel-title">快捷入口</div>
          <div class="quick-entry">
            <div class="entry-item">
              <div class="entry-icon approval" />
              <span>订单审批</span>
            </div>
            <div class="entry-item">
              <div class="entry-icon social" />
              <span>商铺管理</span>
            </div>
            <div class="entry-item">
              <div class="entry-icon role" />
              <span>订单管理</span>
            </div>
            <div class="entry-item">
              <div class="entry-icon salary" />
              <span>订单设置</span>
            </div>
            <div class="entry-item">
              <div class="entry-icon bpm" />
              <span>流程设置</span>
            </div>
          </div>
        </div>
        <!-- 图表数据 -->
        <div class="panel">
          <div class="panel-title">订单审核数据</div>
          <div class="chart-container">
            <div class="chart-info">
              <div class="info-main_png">
                <span>订单人数</span>
                <CountTo :start-val="0" :end-val="223" :duration="1000"></CountTo>

              </div>
              <div class="info-list">
                <div class="info-list-item">
                  <span>待申报(人)</span>
                  <CountTo :start-val="0" :end-val="117" :duration="1000"></CountTo>

                </div>
                <div class="info-list-item">
                  <span>申报中(人)</span>
                  <CountTo :start-val="0" :end-val="167" :duration="1000"></CountTo>

                </div>
                <div class="info-list-item">
                  <span>已申报(人)</span>
                  <CountTo :start-val="0" :end-val="24" :duration="1000"></CountTo>

                </div>
              </div>
            </div>
            <div class="chart">
              <!-- 图表 -->
              <div id="main_png"></div>
            </div>
          </div>
        </div>
        <!-- 图表数据 -->

      </div>
      <!-- 右侧内容 -->
      <div class="right">
        <RightPanel></RightPanel>
        <el-button type="primary">12</el-button>
        <!-- 帮助链接 -->
        <div class="panel">
          <div class="help">
            <div class="help-left">
              <div class="panel-title">帮助链接</div>
              <div class="help-list">
                <div class="help-block">
                  <i class="icon-entry" />
                  入门指南
                </div>
                <div class="help-block">
                  <i class="icon-help" />
                  在线帮助手册
                </div>
                <div class="help-block">
                  <i class="icon-support" />
                  联系技术支持
                </div>
                <div class="help-block">
                  <i class="icon-add" />
                  添加链接
                </div>
              </div>
            </div>
            <div class="help-right">
              <div class="calendar">
                <!-- <el-calendar /> -->
                <el-calendar />
              </div>
            </div>
          </div>
        </div>
        <!-- 通知公告 -->
        <div class="panel">
          <div class="panel-title">通知公告</div>
          <div class="information-list">
            <div class="information-list-item">
              <img src="@/assets/common/bigUserHeader.png" alt="">
              <div>
                <p>
                  <span class="col">罗建平</span> 发布了
                  第1期“后台管理系统”成员名单公布
                </p>
                <p>{{ new Date() }}</p>
              </div>
            </div>
            <div class="information-list-item">
              <img src="@/assets/common/bigUserHeader.png" alt="">
              <div>
                <p>
                  <span class="col">罗建平</span> 发布了
                  第1期“后台管理系统”成员名单公布
                </p>
                <p>{{ new Date() }}</p>
              </div>
            </div>
            <div class="information-list-item">
              <img src="@/assets/common/bigUserHeader.png" alt="">
              <div>
                <p>
                  <span class="col">罗建平</span> 发布了
                  第1期“后台管理系统”成员名单公布
                </p>
                <p>{{ new Date() }}</p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import CountTo from 'vue-count-to'
import RightPanel from '@/components/RightPanel'
import * as echarts from 'echarts/core';
import {
  TitleComponent,
  ToolboxComponent,
  TooltipComponent,
  GridComponent,
  DataZoomComponent
} from 'echarts/components';
import { LineChart } from 'echarts/charts';
import { UniversalTransition } from 'echarts/features';
import { CanvasRenderer } from 'echarts/renderers';

echarts.use([
  TitleComponent,
  ToolboxComponent,
  TooltipComponent,
  GridComponent,
  DataZoomComponent,
  LineChart,
  CanvasRenderer,
  UniversalTransition
]);
export default {
  name: 'home',
  components: {
    CountTo,
    RightPanel
  },
  mounted() {
    var chartDom = document.getElementById('main_png');
    var myChart = echarts.init(chartDom);
    var option;
    // echarts  自适应宽度
    window.addEventListener('resize', function () {
      myChart.resize()
    })
    let base = +new Date(2022, 9, 3);
    let oneDay = 24 * 110 * 1000;
    let date = [];
    let data = [Math.random() * 300];
    for (let i = 1; i < 20000; i++) {
      var now = new Date((base += oneDay));
      date.push([now.getFullYear(), now.getMonth() + 1, now.getDate()].join('/'));
      data.push(Math.round((Math.random() - 0.5) * 20 + data[i - 1]));
    }
    option = {
      tooltip: {
        trigger: 'axis',
        position: function (pt) {
          return [pt[0], '10%'];
        }
      },
      title: {
        left: 'center',
        text: '订单数据'
      },
      toolbox: {
        feature: {
          dataZoom: {
            yAxisIndex: 'none'
          },
          restore: {},
          saveAsImage: {}
        }
      },
      xAxis: {
        type: 'category',
        boundaryGap: false,
        data: date
      },
      yAxis: {
        type: 'value',
        boundaryGap: [0, '100%']
      },
      dataZoom: [
        {
          type: 'inside',
          start: 0,
          end: 10
        },
        {
          start: 0,
          end: 10
        }
      ],
      series: [
        {
          name: 'Fake Data',
          type: 'line',
          symbol: 'none',
          sampling: 'lttb',
          itemStyle: {
            color: 'rgb(255, 70, 131)'
          },
          areaStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
              {
                offset: 0,
                color: 'rgb(255, 158, 68)'
              },
              {
                offset: 1,
                color: 'rgb(255, 70, 131)'
              }
            ])
          },
          data: data
        }
      ]
    };

    option && myChart.setOption(option);
  }
}
</script>

<style scoped lang="scss">
@import '@/assets/theme/handle.scss';

.dashboard {
  background: #f5f6f8;
  width: 100%;
  min-height: calc(100vh - 80px);
  transition: .5s;
  // background-image: url(@/assets/common/login_back.png);/
  @include font_color('titleColor');
  @include background_color('mainColor');
  @include border_color('mainColor');
  @include svg_color('fill');

  ::v-deep .el-calendar-day {
    height: 40px;
  }

  ::v-deep .el-calendar-table__row td,
  ::v-deep .el-calendar-table tr td:first-child,
  ::v-deep .el-calendar-table__row td.prev {
    border: none;
  }

  .date-content {
    height: 40px;
    text-align: center;
    line-height: 40px;
    font-size: 14px;
  }

  .date-content .rest {
    color: #fff;
    border-radius: 50%;
    background: rgb(250, 124, 77);
    width: 20px;
    height: 20px;
    line-height: 20px;
    display: inline-block;
    font-size: 12px;
    margin-left: 10px;
  }

  .date-content .text {
    width: 20px;
    height: 20px;
    line-height: 20px;
    display: inline-block;

  }

  ::v-deep .el-calendar-table td.is-selected .text {
    background: #409eff;
    color: #fff;
    border-radius: 50%;
  }

  ::v-deep .el-calendar__header {
    display: none
  }

  .container {
    display: flex;

    .right {
      width: 40%;

      .panel {
        margin-left: 8px;
      }

      :nth-child(1) {
        margin-top: 0;
      }
    }

    .left {
      flex: 1;

      :nth-child(1) {
        margin-top: 0;
      }
    }

    .panel {
      // background-color: #fff;

      margin-top: 8px;
      padding: 20px;
      transition: .5s;
      @include font_color('titleColor');
      @include background_color('mainColor');
      @include border_color('mainColor');
      @include svg_color('fill');

      .panel-title {
        font-size: 16px;
        color: #383c4e;
        font-weight: 500;
        @include home_titlecolor('homeTitleColor');

      }

      // 用户信息样式
      .user-info {
        display: flex;

        .avatar {
          width: 48px;
          height: 48px;
          border-radius: 12px;
          background-color: #d9d9d9;
          line-height: 48px;
          text-align: center;
        }

        .username {
          width: 30px;
          height: 30px;
          text-align: center;
          line-height: 30px;
          border-radius: 50%;
          background: #04c9be;
          color: #fff;
          margin-right: 4px;
        }

        .company-info {
          margin-left: 10px;
          height: 48px;
          display: flex;
          flex-direction: column;
          justify-content: space-around;


          .title {
            color: #383c4e;
            font-weight: 500;
            font-size: 16px;
            font-family: PingFang SC, PingFang SC-Medium;
            @include font_color('titleColor');


            span {
              font-size: 12px;
              background: #f5f6f8;
              text-align: center;
              padding: 2px 8px;
              border-radius: 2px;
              color: #697086;

            }
          }

          .depart {
            font-size: 14px;
            color: #697086;
            font-weight: 400;
          }
        }
      }

      // 代办样式
      .todo-list {
        margin-top: 10px;
        display: flex;
        flex-wrap: wrap;

        .todo-item {
          width: 16%;
          height: 90px;
          display: flex;
          flex-direction: column;
          padding: 10px;
          justify-content: space-around;

          :nth-child(1) {
            color: #697086;
            font-size: 14px;
            transition: .5s;
            @include font_color('titleColor');

          }

          :nth-child(2) {
            color: #383c4e;
            font-size: 30px;
            font-weight: 500;
            transition: .5s;
            @include font_color('titleColor');

          }
        }
      }

      // 快捷入口
      .quick-entry {
        margin-top: 16px;
        display: flex;

        .entry-item {
          display: flex;
          flex-direction: column;
          align-items: center;
          margin-left: 60px;

          &:nth-child(1) {
            margin-left: 0px;
          }

          .entry-icon {
            width: 40px;
            height: 40px;
            border-radius: 10px;
            background: #f5f6f8;
            background-size: cover;

            &.approval {
              background-image: url('~@/assets/common/approval.png');
            }

            &.social {
              background-image: url('~@/assets/common/social.png');
            }

            &.salary {
              background-image: url('~@/assets/common/salary.png');
            }

            &.role {
              background-image: url('~@/assets/common/role.png');
            }

            &.bpm {
              background-image: url('~@/assets/common/bpm.png');
            }
          }

          span {
            color: #697086;
            transition: .5s;

            @include font_color('titleColor');

            font-size: 14px;
            margin-top: 8px;
          }
        }
      }

      // 图表数据
      .chart-container {
        display: flex;

        .chart-info {
          width: 240px;
          margin-top: 10px;

          .info-main_png {
            padding: 10px;
            display: flex;
            flex-direction: column;

            :nth-child(1) {
              font-size: 14px;
              color: #697086;
            }

            :nth-child(2) {
              margin-top: 10px;
              font-size: 30px;
              color: #04c9be;
              font-weight: 500;
            }
          }

          .info-list {
            background: #f5f6f8;
            border-radius: 4px;
            padding: 12px 15px;
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            transition: .5s;
            @include font_color('titleColor');
            @include background_color('mainColor');
            @include border_color('mainColor');
            @include svg_color('fill');

            .info-list-item {
              width: 50%;
              margin-top: 10px;
              display: flex;
              flex-direction: column;

              :nth-child(1) {
                font-size: 14px;
                color: #697086;
                @include home_titlecolor('homeTitleColor');


              }

              :nth-child(2) {
                margin-top: 10px;
                font-size: 30px;
                color: #383c4e;
                font-weight: 500;
                @include home_titlecolor('homeTitleColor');


              }
            }
          }
        }

        .chart {
          flex: 1
        }
      }

      .el-calendar {
        transition: .5s;
        @include font_color('titleColor');
        @include background_color('mainColor');
        @include border_color('mainColor');
        @include svg_color('fill');
      }

      // 帮助链接
      .help {
        display: flex;
        transition: .5s;

        @include font_color('titleColor');
        @include background_color('mainColor');
        @include border_color('mainColor');
        @include svg_color('fill');

        .help-left {
          width: 40%;
          transition: .5s;

          @include font_color('titleColor');
          @include background_color('mainColor');
          @include border_color('mainColor');
          @include svg_color('fill');
        }

        .help-right {
          flex: 1;
          transition: .5s;

          @include font_color('titleColor');
          @include background_color('mainColor');
          @include border_color('mainColor');
          @include svg_color('fill');
        }

        .help-list {
          .help-block {
            background: #f5f6f8;
            border-radius: 4px;
            width: 264px;
            height: 54px;
            padding: 17px 10px;
            font-size: 14px;
            color: #697086;
            margin-top: 10px;
            transition: .5s;

            @include font_color('titleColor');
            // @include background_color('mainColor');
            @include help-color('help-blockColor');
            @include border_color('mainColor');
            @include svg_color('fill');

            i {
              width: 14px;
              height: 14px;
              display: inline-block;
              background-size: cover;
              vertical-align: middle;
            }

            i.icon-help {
              background-image: url("~@/assets/common/help.png");
            }

            i.icon-support {
              background-image: url("~@/assets/common/support.png");
            }

            i.icon-add {
              background-image: url("~@/assets/common/add.png");
            }

            i.icon-entry {
              background-image: url("~@/assets/common/entry.png");
            }
          }
        }
      }

      // 通知公告
      .information-list {
        margin-top: 20px;

        .information-list-item {
          display: flex;
          align-items: center;
          margin: 15px 0;

          img {
            width: 40px;
            height: 40px;
            border: 50%;
          }

          .col {
            color: #8a97f8;
          }

          div :nth-child(2) {
            color: #697086;
            font-size: 14px;
          }
        }
      }
    }
  }
}

#main_png {
  // width: 100%;
  height: 400px;
}

// @media (max-width:1360px) {
//   #main_png {
//     width: 400px;
//     height: 400px;
//   }
// }</style>
